#define _CRT_SECURE_NO_WARNINGS 1


class Solution {
public:
    int singleNumber(vector<int>& nums)
    {
        int ret = 0;
        for (auto n : nums)
        {
            ret ^= n;
        }
        return ret;
    }
};



class Solution {
public:
    vector<vector<int>> generate(int n)
    {
        vector<vector<int>> ret(n);
        int i = 0, j = 0;
        for (i = 0; i < n; i++)
        {
            j = 0;
            ret[i].resize(i + 1);
            ret[i][j] = ret[i][i] = 1;
            for (j = 1; j < i; j++)
            {
                ret[i][j] = ret[i - 1][j] + ret[i - 1][j - 1];
            }
        }

        return ret;
    }
};


class Solution {
public:
    int singleNumber(vector<int>& nums)
    {
        unordered_map<int, int> hash;
        int ret;
        for (auto n : nums)
        {
            hash[n]++;
        }

        for (auto [n, cnt] : hash)
        {
            if (cnt == 1)
                ret = n;
        }
        return ret;
    }
};



class Solution {
public:
    vector<int> singleNumber(vector<int>& nums)
    {
        unordered_map<int, int> hash;

        for (auto n : nums)
        {
            hash[n]++;
        }

        vector<int> ret;

        for (auto [n, cnt] : hash)
        {
            if (cnt == 1)
            {
                ret.push_back(n);
            }
        }

        return ret;
    }
};